<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <!-- 网站图标 -->
     <link rel="shortcut icon" href="../photo/网站.png" type="image/x-icon">
     <title>五育系统学生端主页面</title>
    <!-- 引入 FontAwesome 5.3.1 图标库 (使用 integrity 属性确保资源的完整性) -->
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css"
        integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
    <!-- 引入 FontAwesome 4.7.0 图标库 (备选方案，若 FontAwesome 5 加载失败可以使用此版本) -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <!-- 引入 Day.js 库用于日期处理 (用于处理日期、格式化和计算) -->
    <script src="https://cdn.bootcdn.net/ajax/libs/dayjs/1.11.12/dayjs.min.js"></script>
    <!-- 引入 Vue.js 库 (用于构建用户界面) -->
    <script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
    <!-- 引入 Axios 库 (用于处理 HTTP 请求) -->
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
    <!-- 引入 Element UI 样式表 (Element UI 是一款流行的 Vue UI 库) -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <!-- 引入 Element UI JavaScript 文件 (包含 Vue 组件和功能) -->
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>

    <!-- 本地脚本引入 -->
    <link rel="stylesheet" href="../css/index.css">
    <link rel="stylesheet" href="../css/icon.css">
    <script src="../js/untils/request.js"></script>
    <script src="../js/mouseonclick.js"></script>
    <!-- <script src="https://fastly.jsdelivr.net/gh/stevenjoezhang/live2d-widget@latest/autoload.js"></script> -->

</head>

<body>
    <div id="app">
        <div id="header" class="header">
            <div class="icon_container">
                <div class="icon_mnue">
                    <ul>
                        <li class="iconfont icon-huojiang" @click="showdiffer(1)">获奖信息填写</li>
                        <li class="iconfont icon-huojiang" @click="showdiffer(4)">查看个人报告</li>
                        <li class="iconfont icon-xuenian" @click="showdiffer(2)">反思与改进</li>
                    </ul>
                </div>
                <span id="369" class="username span"> 欢迎, <span id="StudentId"></span>同学 </span>
                <i id="line" class="line">
                    <span id="notification" style="padding-left: 15px;" :title="notice"
                        class="float fas icon notification" @click="showdiffer(2)"></span>
                    <span class="notification-badge" v-if="commitTotal">{{commitTotal}}</span> <!-- 添加通知的角标 -->
                </i>
                <i class="float icon fas fa-user-tie" title="个人中心" @click="showdiffer(3)"></i>
            </div>
        </div>
        <!-- 是那个页面的小车图案 , 要是客户说改,就跟他说改不了 , 因为我是从网上扒的 ,我不会写 -->
        <div class="content">
            <div v-show="currentId === 0" class="container active">
                <h2 style="color: #aaa;">欢迎来到五育系统,快乐学习,查漏补缺</h2>
                <div class='stage'>
                    <div class='ground-line'>
                        <div>
                            <span class='line1'></span>
                            <span class='line2'></span>
                            <span class='line3'></span>
                            <span class='line1'></span>
                            <span class='line2'></span>
                            <span class='line3'></span>
                        </div>
                    </div>
                    <div class='tree-wrap'>
                        <div class='tree'>
                            <div class='stem'>
                                <div class='branch branch1'></div>
                                <div class='branch branch2'></div>
                                <div class='branch branch3'></div>
                            </div>
                            <div class='leef leef1'></div>
                            <div class='leef leef2'></div>
                        </div>
                    </div>
                    <div class='love-front'>
                        <div class='love-wrap'>
                            <div class='love'>
                                <span class='circle circle1'></span>
                                <span class='circle circle2'></span>
                                <span class='square'></span>
                            </div>
                        </div>
                        <div class='love-wrap'>
                            <div class='love'>
                                <span class='circle circle1'></span>
                                <span class='circle circle2'></span>
                                <span class='square'></span>
                            </div>
                        </div>
                        <div class='love-wrap'>
                            <div class='love'>
                                <span class='circle circle1'></span>
                                <span class='circle circle2'></span>
                                <span class='square'></span>
                            </div>
                        </div>
                        <div class='love-wrap'>
                            <div class='love'>
                                <span class='circle circle1'></span>
                                <span class='circle circle2'></span>
                                <span class='square'></span>
                            </div>
                        </div>
                        <div class='love-wrap'>
                            <div class='love'>
                                <span class='circle circle1'></span>
                                <span class='circle circle2'></span>
                                <span class='square'></span>
                            </div>
                        </div>
                        <div class='love-wrap'>
                            <div class='love'>
                                <span class='circle circle1'></span>
                                <span class='circle circle2'></span>
                                <span class='square'></span>
                            </div>
                        </div>
                        <div class='love-wrap'>
                            <div class='love'>
                                <span class='circle circle1'></span>
                                <span class='circle circle2'></span>
                                <span class='square'></span>
                            </div>
                        </div>
                        <div class='love-wrap'>
                            <div class='love'>
                                <span class='circle circle1'></span>
                                <span class='circle circle2'></span>
                                <span class='square'></span>
                            </div>
                        </div>
                        <div class='love-wrap'>
                            <div class='love'>
                                <span class='circle circle1'></span>
                                <span class='circle circle2'></span>
                                <span class='square'></span>
                            </div>
                        </div>
                        <div class='love-wrap'>
                            <div class='love'>
                                <span class='circle circle1'></span>
                                <span class='circle circle2'></span>
                                <span class='square'></span>
                            </div>
                        </div>
                        <div class='love-wrap'>
                            <div class='love'>
                                <span class='circle circle1'></span>
                                <span class='circle circle2'></span>
                                <span class='square'></span>
                            </div>
                        </div>
                        <div class='love-wrap'>
                            <div class='love'>
                                <span class='circle circle1'></span>
                                <span class='circle circle2'></span>
                                <span class='square'></span>
                            </div>
                        </div>
                    </div>
                    <div class='love-back'>
                        <div class='love-wrap'>
                            <div class='love'>
                                <span class='circle circle1'></span>
                                <span class='circle circle2'></span>
                                <span class='square'></span>
                            </div>
                        </div>
                        <div class='love-wrap'>
                            <div class='love'>
                                <span class='circle circle1'></span>
                                <span class='circle circle2'></span>
                                <span class='square'></span>
                            </div>
                        </div>
                        <div class='love-wrap'>
                            <div class='love'>
                                <span class='circle circle1'></span>
                                <span class='circle circle2'></span>
                                <span class='square'></span>
                            </div>
                        </div>
                        <div class='love-wrap'>
                            <div class='love'>
                                <span class='circle circle1'></span>
                                <span class='circle circle2'></span>
                                <span class='square'></span>
                            </div>
                        </div>
                        <div class='love-wrap'>
                            <div class='love'>
                                <span class='circle circle1'></span>
                                <span class='circle circle2'></span>
                                <span class='square'></span>
                            </div>
                        </div>
                        <div class='love-wrap'>
                            <div class='love'>
                                <span class='circle circle1'></span>
                                <span class='circle circle2'></span>
                                <span class='square'></span>
                            </div>
                        </div>
                        <div class='love-wrap'>
                            <div class='love'>
                                <span class='circle circle1'></span>
                                <span class='circle circle2'></span>
                                <span class='square'></span>
                            </div>
                        </div>
                        <div class='love-wrap'>
                            <div class='love'>
                                <span class='circle circle1'></span>
                                <span class='circle circle2'></span>
                                <span class='square'></span>
                            </div>
                        </div>
                    </div>
                    <div class='vehicle-body'>
                        <div class='wrap-body'>
                            <div class='rooftop back'></div>
                            <div class='rooftop front'></div>
                            <div class='body-cover'>
                                <div class='top-roof'></div>
                                <div class='indi back-top-indicator'></div>
                                <div class='indi back-bottom-indicator'></div>
                                <div class='back-window'>
                                    <div class='window-base top'></div>
                                    <div class='window-base bottom'></div>
                                    <div class='sun-shade'></div>
                                    <div class='curtain'>
                                        <span></span>
                                        <span></span>
                                        <span></span>
                                        <span></span>
                                        <span></span>
                                        <span></span>
                                        <span></span>
                                        <span></span>
                                    </div>
                                    <div class='windows-glass-wrap'>
                                        <div class='glass'>
                                            <div class='light'>
                                                <span class='light1'></span>
                                                <span class='light2'></span>
                                                <span class='light3'></span>
                                            </div>
                                        </div>
                                        <div class='glass'>
                                            <div class='light'>
                                                <span class='light1'></span>
                                                <span class='light2'></span>
                                                <span class='light3'></span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class='front-window'>
                                    <div class='window-base'></div>
                                    <div class='sun-shade'></div>
                                    <div class='curtain'>
                                        <span></span>
                                        <span></span>
                                        <span></span>
                                    </div>
                                    <div class='windows-glass-wrap'>
                                        <div class='light'>
                                            <span class='light1'></span>
                                            <span class='light2'></span>
                                            <span class='light3'></span>
                                        </div>
                                    </div>
                                    <div class='air-hole'>
                                        <span></span>
                                        <span></span>
                                        <span></span>
                                        <span></span>
                                        <span></span>
                                    </div>
                                </div>
                            </div>
                            <div class='main-door'>
                                <div class='glass'>
                                    <div class='light'>
                                        <span class='light1'></span>
                                        <span class='light2'></span>
                                    </div>
                                </div>
                                <div class='door-handle'></div>
                            </div>
                            <div class='side-guard'>
                                <div class='shade'></div>
                                <div class='bumper back'></div>
                                <div class='bumper front'></div>
                                <div class='front-indicator'></div>
                            </div>
                        </div>
                        <div class='wheel-wrap back'>
                            <div class='wheel-shadow'></div>
                            <div class='wheel'>
                                <div class='wheel-outer'>
                                    <div class='wheel-cup'>
                                        <span></span>
                                        <span></span>
                                        <span></span>
                                        <span></span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class='wheel-wrap front'>
                            <div class='wheel-shadow'></div>
                            <div class='wheel'>
                                <div class='wheel-outer'>
                                    <div class='wheel-cup'>
                                        <span></span>
                                        <span></span>
                                        <span></span>
                                        <span></span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div v-show="currentId === 1" class="container active show1">
                <div class="appcontainer">
                    <el-row :gutter="10" class="mb8">
                        <el-col :span="1.5">
                            <el-button type="primary" plain icon="el-icon-plus" @click="handleAdd">新增</el-button>
                        </el-col>
                    </el-row>
                </div>
                <template>
                    <el-table :data="prizeinfo" class="table-container">
                        <el-table-column label="奖项名称" width="220" show-overflow-tooltip align="center">
                            <template slot-scope="scope">
                                {{scope.row.awardName}}
                            </template>
                        </el-table-column>

                        <el-table-column label="奖项等级" width="220" align="center">
                            <template slot-scope="scope">
                                <el-popover trigger="hover" placement="top">
                                    <p>获奖等级: {{ awardLevels[scope.row.awardLevel].label }}</p>
                                    <div slot="reference" class="name-wrapper">
                                        <el-tag size="medium">{{ scope.row.awardLevel }}</el-tag>
                                    </div>
                                </el-popover>
                            </template>
                        </el-table-column>

                        <el-table-column label="获奖日期" width="220" align="center">
                            <template slot-scope="scope">
                                <i class="el-icon-time"></i>
                                <span style="margin-left: 10px">{{ scope.row.awardDate }}</span>
                            </template>
                        </el-table-column>

                        <el-table-column label="获奖证明" width="180" align="center">
                            <template slot-scope="scope">
                                <img :src="scope.row.awardPhotoPath" alt="奖项照片" class="image">
                            </template>
                        </el-table-column>

                        <el-table-column label="操作" align="center">
                            <template slot-scope="scope">
                                <el-button size="mini" @click="handleEdit(scope.$index, scope.row)"
                                    type="primary">编辑</el-button>
                                <el-button size="mini" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </template>

                <!-- 添加或修改获奖信息对话框 -->
                <el-dialog :title="title" :visible.sync="open" width="400px" append-to-body>
                    <el-form ref="awardsRef" :model="avartform" :rules="rules" label-width="90px">
                        <el-form-item label="获奖名称" prop="awardName">
                            <el-input v-model="avartform.awardName" placeholder=" 请输入获奖名称" />
                        </el-form-item>
                        <el-form-item label="等级" prop="awardLevel">
                            <el-select v-model="avartform.awardLevel" placeholder=" 请选择等级">
                                <el-option v-for="(item, index) in awardLevels" :key="index" :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="获奖日期" prop="awardDate">
                            <el-date-picker v-model="avartform.awardDate" type="date" placeholder="  选择日期">
                            </el-date-picker>
                        </el-form-item>
                        <el-form-item label="图片" prop="awardPhotoPath" class="avartimage">
                            <el-upload class="avatar-uploader" action="http://60.205.234.107:7512/common/upload"
                                :show-file-list="false" :on-success="handleAvatarSuccess"
                                :before-upload="beforeAvatarUpload">
                                <img v-if="avartform.awardPhotoPath" :src="avartform.awardPhotoPath" class="avatar">
                                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                            </el-upload>
                        </el-form-item>
                    </el-form>
                    <template #footer>
                        <div class="dialog-footer">
                            <el-button type="primary" @click="submitForm">确 定</el-button>
                            <el-button @click="handleClose">取 消</el-button>
                        </div>
                    </template>
                </el-dialog>
            </div>
            <div v-show="currentId === 2" class="container Commitbox">
                <div class="Commitboxx">
                    <el-table :data="Teachercommit" style="width: 100%" :row-class-name="tableRowClassName">
                        <!-- 评论内容 -->
                        <el-table-column prop="comment" label="评论内容" width="220" align="center" show-overflow-tooltip>
                        </el-table-column>
                        <!-- 评论时间 -->
                        <el-table-column prop="commentTime" :formatter="formatDate" label="评论时间" width="220"
                            align="center">
                        </el-table-column>
                        <!-- 是否已看 -->
                        <el-table-column label="是否已看" align="center">
                            <template slot-scope="scope">
                                <el-tag :type="scope.row.statue == 1 ? 'success' : 'danger'">{{scope.row.statue == 1 ?
                                    '已看' : '未看'}}</el-tag>
                            </template>
                        </el-table-column>
                        <!-- 是否确认已读 -->
                        <el-table-column label="是否确认已读" align="center">
                            <template slot-scope="scope">
                                <el-button type="text" size="small" v-if="scope.row.statue == 0"
                                    @click="handleCommitEdit(scope.$index, scope.row)">已完成阅读</el-button>
                                <el-button type="text" size="small" v-if="scope.row.statue != 0">-----</el-button>
                            </template>
                        </el-table-column>
                        <!-- 学生自我评价 -->
                        <el-table-column prop="evaluationText" label="学生自我评价" width="180" align="center"
                            show-overflow-tooltip>
                            <template slot-scope="scope">
                                <!-- 如果 evaluationText 存在，则显示其内容，否则显示 '暂无' -->
                                <span>{{ scope.row.evaluationText || '-----' }}</span>
                            </template>
                        </el-table-column>
                        <!-- 操作 -->
                        <el-table-column label="操作" align="center">
                            <template slot-scope="scope">
                                <el-button type="text" size="small" v-if="scope.row.statue == 0">请先确认已读</el-button>
                                <el-button type="text" size="small"
                                    v-if="scope.row.evaluationText == '' && scope.row.statue == 1"
                                    @click="AddStudentEvaluation(scope.$index, scope.row)">去自我评价</el-button>
                                <el-button type="text" size="small" v-if="scope.row.evaluationText != ''"
                                    @click="UpdateStudentEvaluation(scope.$index, scope.row)">修改自我评价</el-button>
                            </template>
                        </el-table-column>
                        <!-- 评论状态 -->
                        <el-table-column prop="feedbackStatus" label="评论内容" width="220" align="center">
                            <template slot-scope="scope">
                                <el-tag v-if="scope.row.feedbackStatus === 'pending'" type="warning">待处理</el-tag>
                                <el-tag v-if="scope.row.feedbackStatus === 'approved'" type="success">通过</el-tag>
                                <el-tag v-if="scope.row.feedbackStatus === 'rejected'" type="danger">未通过</el-tag>
                                <el-tag v-if="scope.row.feedbackStatus === ''" type="info">暂无自我评价</el-tag>
                            </template>
                        </el-table-column>
                    </el-table>
                    <!-- 弹出框 - 新增自我评价-->
                    <el-dialog :title="dialogtitle" :visible.sync="centerDialogVisible" width="50%" center>
                        <el-form ref="EvaluationRef" :model="Dialogform1" :rules="rules" label-width="90px">
                            <el-form-item label="学号" prop="studentId">
                                <el-input v-model="Dialogform1.studentId" :disabled="true" />
                            </el-form-item>
                            <el-form-item label="评价时期" prop="commentTime">
                                <el-input v-model="Dialogform1.commentTime" :disabled="true" />
                            </el-form-item>
                            <el-form-item label="自我评价" prop="evaluationText">
                                <el-input type="textarea" v-model="Dialogform1.evaluationText" />
                            </el-form-item>
                        </el-form>
                        <template #footer>
                            <div class="dialog-footer">
                                <el-button type="primary" @click="EsubmitForm">确 定</el-button>
                                <el-button @click="handleClose">取 消</el-button>
                            </div>
                        </template>
                    </el-dialog>
                </div>
            </div>
            <div v-show="currentId === 3" class="container show3">
                <template>
                    <div>
                        <el-row :gutter="20" style="margin:10px;">
                            <el-col :span="8">
                                <div class="grid-content bg-purple">
                                    <el-card class="box-card">
                                        <div slot="header" class="clearfix">
                                            <span>👩🏻‍🎓 个人中心</span>
                                        </div>
                                        <div class="name-role">
                                            <el-tag class="sender">{{combinedstudnetIdAndname}}</el-tag>
                                        </div>
                                        <el-divider></el-divider>
                                        <div class="personal-relation">
                                            <div class="relation-item">班级信息 :
                                                <el-tag>{{Studnetinfo.gender ==1 ? "男" : "女"}}</el-tag>
                                            </div>
                                        </div>
                                        <div class="personal-relation">
                                            <div class="relation-item">班级信息 :
                                                <el-tag>{{Studnetinfo.studentclass}}</el-tag>
                                            </div>
                                        </div>
                                        <div class="personal-relation">
                                            <div class="relation-item">年级信息 : <el-tag>{{getgrade}}年级</el-tag></div>
                                        </div>
                                        <div class="personal-relation">
                                            <div class="relation-item">学校信息 :
                                                <el-tag>{{Studnetinfo.scchoolMeaasge}}</el-tag>
                                            </div>
                                        </div>

                                    </el-card>
                                </div>
                            </el-col>
                            <el-col :span="16">
                                <div class="grid-content bg-purple">
                                    <el-card class="box-card">
                                        <div slot="header" class="clearfix">
                                            <span>基本资料</span>
                                        </div>
                                        <div>
                                            <el-form label-width="150px" size="small" label-position="right">
                                                <el-form-item label="请选择出生日期" prop="birthDate">
                                                    <el-date-picker v-model="Studnetinfo.birthDate" type="date"
                                                        placeholder="请选择出生日期" format="yyyy-MM-dd"
                                                        value-format="yyyy-MM-dd" class="form_input">
                                                    </el-date-picker>
                                                </el-form-item>

                                                <el-form-item label="请选择生源地" prop="nickName" label-width="150px">
                                                    <el-select v-model="Studnetinfo.originPlace" placeholder="请选择生源地">
                                                        <el-option v-for="(item, index) in areas" :key="index"
                                                            :label="item.name" :value="item.value">
                                                        </el-option>
                                                    </el-select>
                                                </el-form-item>

                                                <el-form-item label="请选择是否独生" prop="phone">
                                                    <el-select v-model="Studnetinfo.isOnlyChild" placeholder="请选择是否独生">
                                                        <el-option v-for="(item, index) in onlyChildOptions"
                                                            :key="index" :label="item.name" :value="item.value">
                                                        </el-option>
                                                    </el-select>
                                                </el-form-item>
                                                <el-form-item label="请输入班级职务" prop="homeUrl" style="width: 600px;">
                                                    <el-input type="textarea" placeholder="请输入班级职务"
                                                        v-model="Studnetinfo.cadrePosition" :rows="5"
                                                        style="width: 100%; resize: none; font-size: 14px;"></el-input>
                                                </el-form-item>

                                            </el-form>
                                            <div slot="footer" class="dialog-footer">
                                                <el-button size="mini" type="primary" @click="sumbit()">提交</el-button>
                                            </div>
                                        </div>
                                    </el-card>
                                </div>
                            </el-col>
                        </el-row>
                    </div>
                </template>
            </div>
            <div v-show="currentId === 4" class="container">
                <div class="show4">
                    <div class="card" v-for="(item, index) in carList" :key="index">
                        <div class="imgBx" :style="{ '--img': 'url(' + item.img + ')' }">
                        </div>
                        <div class="contentbox">
                            <h4>{{item.name}}<br /><span v-if="index == 0">当前学期</span></h4>
                            <p>
                                <span class="iconfont icon-chakan chakanpapres"
                                    @click="jumpurl('../html/show.html' , item.name)">横向发展报告</span><br />
                                <span class="iconfont icon-chakan chakanpapres"
                                    @click="jumpurl(`../html/ShowTrend.html`, item.name)">纵向发展报告</span>
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
<script>
    const httpService = new HttpService('http://60.205.234.107:7512');
    // const httpService = new HttpService('http:localhost:8080');

    new Vue({
        el: '#app',
        data: {
            currentId: 0, // 默认显示的内容
            StudentId: '',
            Studnetinfo: {},
            // 生源地的选项
            areas: [],
            // 是否独生的选项
            onlyChildOptions: [],
            // 任职信息
            employmentinfo: "",
            // 获奖信息
            prizeinfo: [],
            isorigin: "",
            // 奖项等级
            awardLevels: [
                { value: 0, label: "校级" },
                { value: 1, label: "省级" },
                { value: 2, label: "国家级" },
                { value: 3, label: "其他" }
            ],
            // 弹出框显示类型
            valid: 0,
            // 评论内容
            Teachercommit: [],
            commitTotal: 0,
            // 记录状态为未看的id
            unread: [],
            tableData: [],
            // vue属性
            multiple: true,
            open: false,
            title: "",
            avartform: {
                awardName: "",
                awardLevel: null,
                awardDate: "",
                awardPhotoPath: ""
            },
            rules: {
                awardName: [
                    { required: true, message: "获奖名称不能为空", trigger: "blur" }
                ],
                awardLevel: [
                    { required: true, message: "等级不能为空", trigger: "change" }
                ],
                awardDate: [
                    { required: true, message: "获奖日期不能为空", trigger: "blur" }
                ],
                awardPhotoPath: [
                    { required: true, message: "照片不能为空", trigger: "blur" }
                ]
            },
            // 弹出框 学生自评功能
            centerDialogVisible: false,
            dialogtitle: "",
            Dialogform1: {},
            DiagType: 0,

            imageUrl: [
                "https://pic.imgdb.cn/item/674956edd0e0a243d4dac1db.jpg",
                "https://pic.imgdb.cn/item/67496e13d0e0a243d4dad861.jpg",
                "https://pic.imgdb.cn/item/67225467d29ded1a8cbba11e.jpg",
                "https://pic.imgdb.cn/item/67496e33d0e0a243d4dad871.gif",
                "https://pic.imgdb.cn/item/67496e33d0e0a243d4dad871.gif",
                "https://pic.imgdb.cn/item/67496e4dd0e0a243d4dad878.jpg",
            ],
            carList: []
        },
        methods: {
            // id === 4
            report4(yearMonth) {
                const List = this.getSemesterNames(yearMonth).reverse()
                List.forEach(item => {
                    var randomItem = this.imageUrl[Math.floor(Math.random() * this.imageUrl.length)];
                    this.carList.push({
                        name: item,
                        img: randomItem
                    })
                })
            },

            getSemesterNames(admissionYear) {
                const currentYear = new Date().getFullYear();
                const currentMonth = new Date().getMonth() + 1;
                let semesterNames = [];

                // 计算入学到当前学期的总学期数
                let totalSemesters = (currentYear - admissionYear) * 2 + (currentMonth >= 9 || currentMonth === 0 ? 1 : 0);

                // 遍历每个学期，生成学期名称
                for (let i = 0; i < totalSemesters; i++) {
                    let grade = Math.floor(i / 2) + 1;  // 年级，i / 2 向下取整
                    let semester = i % 2 === 0 ? '上学期' : '下学期';  // 奇偶学期判断

                    // 生成学期名称并加入数组
                    semesterNames.push(`${grade}年级${semester}`);
                }

                return semesterNames;
            },
            showdiffer(id) {
                this.currentId = id; // 更新当前显示的内容
            },
            jumpurl(url,itemName) {
                // 构造目标 URL，使用查询参数传递 itemName
                localStorage.setItem('Yearstem', itemName);
                // const jumpurl = `${url}?yearTime=${itemName}`;
                window.location.href = url;
            },
            getinfo(StudentId) {
                this.Studnetinfo = {}
                this.areas = []
                this.onlyChildOptions = []
                httpService.get(`/students/students/getinfo/${StudentId}`).then(res => {
                    this.Studnetinfo = res;
                    this.report4(res.yearAdmission)
                    localStorage.setItem('yearAdmission', res.yearAdmission);
                })
                const dictName1 = 'student_orgin_address'
                const dictName2 = 'onlyChildOptions'
                // 获取字典信息
                httpService.get(`/system/dict/data/type/${dictName1}`).then(res => {
                    if (res.code === 200) {
                        res.data.forEach(item => {
                            this.areas.push({
                                value: item.dictValue,
                                name: item.dictLabel
                            })
                        })
                    }
                })
                httpService.get(`/system/dict/data/type/${dictName2}`).then(res => {
                    if (res.code === 200) {
                        res.data.forEach(item => {
                            this.onlyChildOptions.push({
                                value: item.dictValue,
                                name: item.dictLabel
                            })
                        })
                    }
                })
            },
            // 获取获奖信息
            getprize(StudentId) {
                httpService.get(`/awards/awards/getaward/${StudentId}`).then(res => {
                    console.log(res);
                    this.prizeinfo = res.data
                })
            },
            sumbit() {
                var data = {
                    studentId: this.StudentId,
                    id: this.Studnetinfo.id,
                    isOnlyChild: this.onlyChildOptions.find(item => item.value === this.Studnetinfo.isOnlyChild)?.name || '',
                    birthDate: this.Studnetinfo.birthDate,
                    cadrePosition: this.Studnetinfo.cadrePosition,
                    originPlace: this.areas.find(area => area.value === this.Studnetinfo.originPlace)?.name || ''
                };

                httpService.put(`/students/students/submitinfo`, data).then(res => {
                    if (res.code === 200) {
                        alert('提交成功')
                        this.getinfo(this.StudentId)
                    }
                })
            },
            handleEdit(index, row) {
                this.valid = 1
                this.resetform()
                this.title = "修改获奖信息"
                this.avartform = row;
                this.avartform.awardLevel = parseInt(row.awardLevel, 10); // 转换为整数
                this.open = true;
            },
            handleDelete(index, row) {
                this.$confirm('此操作将永久删除该获奖信息, 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    httpService.delete(`/awards/awards/${row.awardId}`).then(res => {
                        this.getprize(this.StudentId)
                        if (res.code === 200) {
                            this.$message({
                                type: 'success',
                                message: '删除成功!'
                            });
                            this.getprize(this.StudentId)
                        } else {
                            this.$message({
                                type: 'error',
                                message: '删除失败!'
                            });
                        }
                    })
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
                });
            },
            handleAdd() {
                this.resetform()
                this.title = "添加获奖信息"
                this.open = true
                this.valid = 2
            },
            handleAvatarSuccess(res, file) {
                this.avartform.awardPhotoPath = res.url;
            },
            beforeAvatarUpload(file) {
                const isJPG = file.type === 'image/jpeg';
                const isLt2M = file.size / 1024 / 1024 < 2;

                if (!isJPG) {
                    this.$message.error('上传头像图片只能是 JPG 格式!');
                }
                if (!isLt2M) {
                    this.$message.error('上传头像图片大小不能超过 2MB!');
                }
                return isJPG && isLt2M;
            },
            // 获奖提交
            submitForm() {
                if (this.valid === 2) {
                    this.avartform.studentId = this.StudentId
                    httpService.post(`/awards/awards`, this.avartform).then(res => {
                        this.getprize(this.StudentId)
                        this.open = false
                    })
                } else {
                    this.avartform.studentId = this.StudentId
                    httpService.put(`/awards/awards`, this.avartform).then(res => {
                        this.getprize(this.StudentId)
                        this.open = false
                    })
                }
            },
            // 表单重置
            resetform() {
                this.avartform = {
                    awardName: "",
                    awardLevel: null,
                    awardDate: "",
                    awardPhotoPath: ""
                }

                this.Dialogform1 = {}
            },
            handleClose() {
                this.open = false
                this.centerDialogVisible = false
                this.resetform()
            },

            // 获取评论信息
            getcomment(StudentId) {
                this.commitTotal = 0
                this.Teachercommit = []
                this.commitTotal = 0
                httpService.get(`/comments/comments/list/${StudentId}`).then(res => {
                    res.forEach(element => {
                        // 0表示未看  1表示已看
                        // pending', 'approved', 'rejected
                        const commentTime = element.commentTime
                        httpService.get(`/StudentEvaluation/getStudentEvaluation/${StudentId}/${commentTime}`).then(res => {
                            if (res.code == 200 && res.data) {
                                var temp = {}
                                temp = {
                                    comment: element.comment,
                                    commentTime: element.commentTime,
                                    commentid: element.commentid,
                                    statue: element.statue,
                                    studentId: element.studentid,
                                    teacherId: element.teacherid,
                                    evaluationId: res.data.id,
                                    evaluationStatus: res.data.evaluationStatus,
                                    evaluationText: res.data.evaluationText,
                                    feedbackStatus: res.data.feedbackStatus,
                                    feedbackText: res.data.feedbackText
                                }
                                if (temp.feedbackStatus == 'rejected') this.commitTotal++
                                this.Teachercommit.push(temp)
                                // this.Teachercommit.put(temp)
                            } else if (res.code == 200) {
                                var temp = {}
                                temp = {
                                    comment: element.comment,
                                    commentTime: element.commentTime,
                                    commentid: element.commentid,
                                    statue: element.statue,
                                    studentId: element.studentid,
                                    teacherId: element.teacherid,
                                    evaluationId: '',
                                    evaluationStatus: "",
                                    evaluationText: "",
                                    feedbackStatus: "",
                                    feedbackText: ""
                                }
                                this.Teachercommit.push(temp)
                            }
                        })

                        if (element.statue == 0) {
                            this.commitTotal++
                            this.unread.push(element.commentid)
                        }
                    })
                })
            },

            tableRowClassName({ row, rowIndex }) {
                if (rowIndex === 1) {
                    return 'warning-row';
                } else if (rowIndex === 3) {
                    return 'success-row';
                }
                return '';
            },
            handleCommitEdit(index, row) {
                row.statue = 1
                this.$confirm('是否确认已读?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    httpService.put('/comments/comments', row).then(res => {
                        if (res.code == 200) {
                            this.$message({
                                type: 'success',
                                message: '已读成功!'
                            });
                            this.getcomment(this.StudentId)
                        }
                    })
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消提交'
                    })
                    this.getcomment(this.StudentId)
                })
            },

            // 新增评论
            AddStudentEvaluation(index, row) {
                this.dialogtitle = '新增评论'
                this.DiagType = 0
                this.Dialogform1 = {
                    evaluationStatus: row.evaluationStatus,
                    evaluationText: row.evaluationText,
                    feedbackStatus: row.feedbackStatus,
                    feedbackText: row.feedbackText,
                    studentId: row.studentId,
                    teacherId: row.teacherId,
                    evaluationId: row.evaluationId,
                    commentTime: row.commentTime
                }

                this.centerDialogVisible = true
            },
            // 修改评论
            UpdateStudentEvaluation(index, row) {
                this.dialogtitle = '修改评论'
                this.centerDialogVisible = true
                this.Dialogform1 = row
                this.DiagType = 1
                console.log(row);
            },
            // 新增
            EsubmitForm() {
                if (this.DiagType == 0) {
                    this.Dialogform1.evaluationStatus = 'pending'
                    this.Dialogform1.feedbackStatus = 'pending'
                    httpService.post('/StudentEvaluation/insertStudentEvaluation', this.Dialogform1).then(res => {
                        if (res.code == 200) {
                            this.getcomment(this.StudentId)
                            this.centerDialogVisible = false
                            this.resetform()
                        }
                    })
                } else if (this.DiagType == 1) {
                    this.Dialogform1.evaluationStatus = 'pending'
                    this.Dialogform1.feedbackStatus = 'pending'
                    this.Dialogform1.id = this.Dialogform1.evaluationId
                    httpService.put('/StudentEvaluation/updateStudentEvaluation', this.Dialogform1).then(res => {
                        console.log(res);
                        if (res.code == 200) {
                            this.getcomment(this.StudentId)
                            this.centerDialogVisible = false
                            this.resetform()
                        }
                    })
                }
            }

        },
        computed: {
            combinedstudnetIdAndname() {
                return this.Studnetinfo.name + "    " + this.Studnetinfo.studentId; // 连接学号和学生 ID
            },
            getgrade() {
                const currentYear = new Date().getFullYear();
                return currentYear - this.Studnetinfo.yearAdmission + 1;
            },
            notice() {
                return "通知" + this.commitTotal + "条"
            },
            formatDate(row, column, cellValue) {
                if (!cellValue) return '';
                return dayjs(cellValue).format('YYYY-MM'); // 你可以调整格式
            },
        },
        mounted() {
            var StudentId = localStorage.getItem("StudentId");
            if (StudentId) {
                document.getElementById("StudentId").innerText = StudentId;
                this.StudentId = StudentId;
                this.getinfo(StudentId);
                this.getprize(StudentId)
                this.getcomment(StudentId)
            } else {
                document.getElementById("StudentId").innerText = ' . . . ';
            }
        },
    });

</script>

</html>